﻿using Common;
using FilterModel;
using IBll;
using MainService.Controllers.Extend;
using ResponseModel;
using System;
using System.Web.Http;

namespace MainService.Controllers
{
    /// <summary>
    /// 上传控制器
    /// </summary>
    [LoginAuthorizationFilter]
    public class UploadController : BaseApiController
    {
        public IFileBll FileBll { get; set; }

        /// <summary>
        /// 通用
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ResultModel Common()
        {
            ResultModel resultModel = new ResultModel();

            try
            {
                if (FileBll.UploadFile("Common"))
                {
                    resultModel.Pass = true;
                    resultModel.Msg = "上传成功";
                }
                else
                {
                    resultModel.Msg = "上传失败";
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error("报错：" + ex);
                resultModel.Msg = "报错：" + ex;
            }

            return resultModel;
        }
    }
}